﻿using System;
using System.AutoUpdate.Interfaces;
using System.AutoUpdate.Managers;
using System.AutoUpdate.Operations;
using System.AutoUpdate.Sources;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace System.AutoUpdate.Test
{
    [TestClass]
    public class OperationTest
    {
        [TestMethod]
        public void CheckOperationStartOperationTest ()
        {
            SourceManager.Instance.Sources.Add (new TextWebSource("http://www.arvystate.net/test/AutoUpdate/", "patches.txt", "Download"));

            CheckOperation operation = new CheckOperation();

            operation.OperationCompleted += (sender, args) =>
                                            {
                                                Assert.IsTrue (args.Exception == null, "CheckOperation successful.");
                                                Assert.IsTrue (args.UpdateInfo.AvailableVersions.Count > 0, "CheckOperation successful.");
                                            };

            operation.StartOperation (null);
        }
    }
}
